/**
 * @author zhoushengtao
 * @since 2012-9-7 下午6:57:32
 */

package com.stchou.superbrowser.activity;

import com.stchou.superbrowser.ui.adapter.NavListViewAdapter;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ExpandableListView;

import java.util.List;

public class ListInfoActivity extends Activity
{
    ExpandableListView expandableListView;

    NavListViewAdapter treeViewAdapter;

    public String[] groups =
    {
        "列表1", "列表2", "列表3"
    };

    public String[][] child =
    {
        {
            ""
    },
        {
            ""
    },
        {
            "", ""
    }
    };

    
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        initViews();
    }
    
    
    private void initViews()
    {
        treeViewAdapter = new NavListViewAdapter(this,
                NavListViewAdapter.PaddingLeft >> 1);
//        expandableListView = (ExpandableListView)this
//                .findViewById(R.id.expandableListView);

        List<NavListViewAdapter.TreeNode> treeNode = treeViewAdapter.GetTreeNode();
        for (int i = 0; i < groups.length; i++)
        {
            NavListViewAdapter.TreeNode node = new NavListViewAdapter.TreeNode();
            node.setParent(groups[i]);
            for (int ii = 0; ii < child[i].length; ii++)
            {
                node.childs.add(child[i][ii]);
            }
            treeNode.add(node);
        }

        treeViewAdapter.UpdateTreeNode(treeNode);
        expandableListView.setAdapter(treeViewAdapter);
    }
}
